|
ARD2
1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
|
00001 00018 #ifndef APPLICATION_GLOBALS_H_ 00019 #define APPLICATION_GLOBALS_H_ 00020 00021 /* 00022 ************************************************************** 00023 * Defines, Macros and Typedefs 00024 **************************************************************/ 00025 /*** Constant Macros ***/ 00026 /* Default Yes and No defines */ 00027 #ifndef TRUE 00028 #define TRUE (1u) 00029 #endif 00030 #ifndef CLEAR 00031 #define CLEAR (0u) 00032 #endif 00033 #ifndef BITS_IN_NIBBLE 00034 #define BITS_IN_NIBBLE (4u) 00035 #endif 00036 #ifndef BITS_IN_BYTE 00037 #define BITS_IN_BYTE (8u) 00038 #endif 00039 #ifndef BYTES_IN_16 00040 #define BYTES_IN_16 (2u) 00041 #endif 00042 #ifndef BYTES_IN_32 00043 #define BYTES_IN_32 (4u) 00044 #endif 00045 00046 #ifndef BIT_DEFINITION 00047 #define BIT_DEFINITION 00048 #define BIT0 (1u << 0u) 00049 #define BIT1 (1u << 1u) 00050 #define BIT2 (1u << 2u) 00051 #define BIT3 (1u << 3u) 00052 #define BIT4 (1u << 4u) 00053 #define BIT5 (1u << 5u) 00054 #define BIT6 (1u << 6u) 00055 #define BIT7 (1u << 7u) 00056 #define BIT8 (1u << 8u) 00057 #define BIT9 (1u << 9u) 00058 #define BIT10 (1u << 10) 00059 #define BIT11 (1u << 11) 00060 #define BIT12 (1u << 12) 00061 #define BIT13 (1u << 13) 00062 #define BIT14 (1u << 14) 00063 #define BIT15 (1u << 15) 00064 #define BIT16 (1u << 16) 00065 #define BIT17 (1u << 17) 00066 #define BIT18 (1u << 18) 00067 #define BIT19 (1u << 19) 00068 #define BIT20 (1u << 20) 00069 #define BIT21 (1u << 21) 00070 #define BIT22 (1u << 22) 00071 #define BIT23 (1u << 23) 00072 #define BIT24 (1u << 24) 00073 #define BIT25 (1u << 25) 00074 #define BIT26 (1u << 26) 00075 #define BIT27 (1u << 27) 00076 #define BIT28 (1u << 28) 00077 #define BIT29 (1u << 29) 00078 #define BIT30 (1u << 30) 00079 #define BIT31 (1u << 31) 00080 #endif 00081 00082 /* Index to gau16RawAccels */ 00083 #define SM_ALL_ACCEL_SIZE 14u 00084 #define SM_CA_GLOBAL_INDEX 12u 00085 #define SM_PSI5_GLOBAL_INDEX 0u 00086 00087 /* Minimum time that must elapse before requesting a PSI5 value */ 00088 #define SM_MIN_CYCLES_PSI5_REQ ((uint32_t)(0.0005 / TICK_PERIOD)) 00089 00090 /* Thresholds to trigger squibs - here only as demo code. DO NOT USE IN */ 00091 /* FINAL APPLICATION. NEITHER THE AUTHORS OF THIS PROGRAM NOR FREESCALE */ 00092 /* SEMICONDUCTOR CAN BE HELD LIABLE FOR NEGLIGABLY APPLYING THESE */ 00093 /* VALUES WITHOUT PROPER PRIOR RESEARCH. */ 00094 #define PSI_SAT1_THRESHOLD 620u 00095 #define PSI_SAT2_THRESHOLD 620u 00096 #define PSI_SAT3_THRESHOLD 620u 00097 #define PSI_SAT4_THRESHOLD 620u 00098 00099 /* Thresholds to trigger squibs - here only as demo code. DO NOT USE IN */ 00100 /* FINAL APPLICATION. NEITHER THE AUTHORS OF THIS PROGRAM NOR FREESCALE */ 00101 /* SEMICONDUCTOR CAN BE HELD LIABLE FOR NEGLIGABLY APPLYING THESE */ 00102 /* VALUES WITHOUT PROPER PRIOR RESEARCH. */ 00103 00104 #define CA_X_THRESHOLD 2050u 00105 #define CA_Y_THRESHOLD 2050u 00106 00107 /*** Function Macros ***/ 00108 #ifndef N_ELEMENTS 00109 #define N_ELEMENTS(X) (sizeof(X)/sizeof(*(X))) 00110 #endif 00111 00112 /* For correlation table */ 00113 #define SQUIB_CH(XX) XX 00114 #define SAT_CH(XX, YY) ((XX * 3u) + YY) 00115 00116 /*** Enums ***/ 00117 /* index to cau16CACrashThresholds */ 00118 enum CRASH_THESHOLD_CA 00119 { 00120 CA_CRASH_X = CLEAR, CA_CRASH_Y 00121 }; 00122 00123 /*** TypeDefs ***/ 00124 00125 /* 00126 ************************************************************** 00127 * Declarations 00128 **************************************************************/ 00129 /*** Global ***/ 00130 extern vuint16_t gau16RawAccels[SM_ALL_ACCEL_SIZE]; 00131 extern vuint32_t gu32SMCycleStartTime; 00132 extern vuint8_t gu8GUIStateFirstRun; 00133 /*** Static ***/ 00134 00135 /*** Constant ***/ 00136 extern const uint16_t cau16PSI5CrashThresholds[]; 00137 extern const uint16_t cau16CACrashThresholds[]; 00138 extern const uint8_t cau8SatelliteDetectionDirection[]; 00139 extern const uint8_t cau8SatToSquibs[]; 00140 extern const uint8_t cu8SizeOfSatToSquibs; 00141 /* 00142 ************************************************************** 00143 * Function Prototypes 00144 **************************************************************/ 00145 /* 00146 ****************************************************************************** 00147 * 00148 * Function: vfnSMInitAppGlobals() 00149 * 00150 */ 00158 void vfnSMInitAppGlobals(void); 00159 #endif /* APPLICATION_GLOBALS_H_ */